package com.water.wfo.user.ability.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.water.wfo.sys.pojo.entity.MenuEntity;
import com.water.wfo.user.ability.MenuAbility;
import com.water.wfo.user.mapper.MenuMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;

import java.util.Collections;
import java.util.List;

/**
 * <p>
 * 菜单表 服务实现类
 * </p>
 *
 * @author water&7
 * @since 2024-07-24
 */
@Component
public class MenuAbilityImpl implements MenuAbility {
    @Autowired
    private MenuMapper menuMapper;
    @Override
    public int insert(MenuEntity entity) {
        return menuMapper.insert(entity);
    }

    @Override
    public int update(MenuEntity entity) {
        return menuMapper.update(entity);
    }

    @Override
    public List<MenuEntity> queryAllMenuEntity() {
        return menuMapper.queryAllMenuEntity();
    }

    @Override
    public List<MenuEntity> queryMenuEntityBy(MenuEntity entity) {
        return menuMapper.queryMenuEntityBy(entity);
    }

    @Override
    public List<MenuEntity> queryMenuEntityByIds(List<Long> ids) {
        if(CollectionUtils.isEmpty(ids)){
            return Collections.EMPTY_LIST;
        }
        return menuMapper.queryMenuEntityByIds(ids);
    }
}
